package ar.edu.unicen.pladema.ui.mywidgets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;

import ar.edu.unicen.pladema.main.SWTUtils;
import ar.edu.unicen.pladema.resources.ResourceManager;
import ar.edu.unicen.pladema.ui.panel.AbstractPanel;

public class PointXYZPanel extends AbstractPanel {
	private Group group;
	private Label label;
	
	public PointXYZPanel(Composite parent, String title) {
		super(parent);
		group.setText(ResourceManager.getInstance().getText(title));
	}

	@Override
	protected void createWidgets() {
		group = new Group(this, SWT.SHADOW_ETCHED_IN);
		label = new Label(group, SWT.NONE);
	}

	@Override
	protected void layoutWidgets() {
		this.setLayout(new FillLayout(SWT.VERTICAL));
		group.setLayout(new FormLayout());
		label.setLayoutData(SWTUtils.createTopFormData());
	}


	public void setValues(double x, double y, double z) {
		String sX = Double.toString(((int)(x * 1000))/1000.0);
		String sY = Double.toString(((int)(y * 1000))/1000.0);
		String sZ = Double.toString(((int)(z * 1000))/1000.0);
		label.setText("x:" + sX +
				" y:" + sY +
				" z:" + sZ);
	}


}
